package com.cccyy.data;

import com.alibaba.fastjson2.JSON;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class DataSplit {
    public static void main(String[] args) {
//        dealBase64WithSymbol();
//        splitData001();
        splitToList();
    }

    private static void splitToList() {
        String baseDir = "123,456";
        String[] split = baseDir.split(",");
        List<String> otherCertFile = new ArrayList<>(Arrays.asList(split));
        System.out.println(otherCertFile);
    }

    public static void dealWithSymbol() {
        String str = "|123|2222";
        String[] split = str.split("\\|");
        System.out.println(split[0]);
        System.out.println(split[1]);
        System.out.println(split[2]);
    }

    public static void dealWithNoSymbol() {
        String str = "hawer123wetq2222";
        String[] split = str.split("\\|");
//        System.out.println(split[0]);
        System.out.println(split[1]);
    }

    public static void dealBase64WithSymbol() {
        String str = "...";
        String s = str.split(";")[0].split("/")[1];
        System.out.println(s);
    }

    public static void splitData001() {
        String sftpHost = "127.0.0.1";
        List<String> sftpHosts = Arrays.asList(sftpHost.split(","));
        System.out.println(JSON.toJSONString(sftpHosts));
    }
}
